$.fn.tooltip = function(options){
	var defaults = {
		speed: 200,
		delay: 300
	};
	var options = $.extend(defaults, options);
	getTip = function() {
		var tTip = 
			"<div class='tip' style='display:none;'>" +
				"<div class='tipMid'>"	+
				"</div>" +
				"<div class='tipBtm'></div>" +
			"</div>";
		return tTip;
	}
        if ($("body").find('.tip').size() == '0'){
            $("body").prepend(getTip());
	}
	$(this).each(function(){
		
		var $this = $(this);
		var tip = $('.tip');
		var tipInner = $('.tip .tipMid');
		
		var tTitle = (this.title);
		this.title = "";
		
		var offset = $(this).offset();
		var tLeft = offset.left;
		var tTop = offset.top;
		var tWidth = $this.width();
		var tHeight = $this.height();
		$this.hover(
			function() {
				tipInner.html(tTitle);
				setTip(tTop, tLeft);
				setTimer();
			}, 
			function() {
				stopTimer();
				tip.hide();
			}
		);		   
		$this.click(
			function() {
				stopTimer();
				tip.hide();
			}
		);
		setTimer = function() {
			$this.showTipTimer = setInterval("showTip()", defaults.delay);
		}
		
		stopTimer = function() {
			clearInterval($this.showTipTimer);
		}
		setTip = function(top, left){
			var topOffset = tip.height();
			var xTip = (left-60)+"px";
			var yTip = (top-topOffset-35)+"px";
			tip.css({'top' : yTip, 'left' : xTip});
		}
		showTip = function(){
			stopTimer();
			tip.animate({"top": "+=20px", "opacity": "toggle"}, defaults.speed);
		}
	});
};